import {WeaLocaleProvider} from "ecCom";
const getLabel = WeaLocaleProvider.getLabel;

export function changeQuickSearchValue(value) {
    if (this.conditionForm.isFormInit) {
        this.conditionForm.updateFields({
            taskName: { value }
        });
    }
}
export function quickSearch() {
    this.initTable();
}

export function setConditionVisible(visible) {
    this.conditionVisible = visible;
}

export function search() {
    this.initTable();
    this.setConditionVisible(false);
}

export function clearCondition(){
    this.conditionForm.resetForm()
}

export function getConditions() {
    return [{
        title: getLabel('505990','常用条件'),
        defaultshow: true,
        items: [{
            colSpan: 2,
            conditionType: "INPUT",
            domkey: [
                "taskName"
            ],
            fieldcol: 12,
            label:getLabel('505991','标题'),
            labelcol: 6,
            value: "",
            viewAttr: 2
        }, {
            colSpan: 2,
            conditionType: "BROWSER",
            domkey: [
                "creator"
            ],
            fieldcol: 12,
            label: getLabel('505993','发起人'),
            labelcol: 6,
            value: "",
            viewAttr: 2,
            browserConditionParam: {
                completeParams: {},
                conditionDataParams: {},
                dataParams: {},
                destDataParams: {},
                hasAddBtn: false,
                hasAdvanceSerach: true,
                idSeparator: ",",
                isAutoComplete: 1,
                isDetail: 0,
                isMultCheckbox: false,
                isSingle: false,
                pageSize: 10,
                quickSearchName: "",
                replaceDatas: [],
                title: getLabel('505994','人力资源'),
                type: "17",
                viewAttr: 2
            },
        }, {
            colSpan: 2,
            fieldcol: 12,
            labelcol: 6,
            conditionType: "SELECT_LINKAGE",
            selectLinkageDatas: {
                "6": {
                    conditionType: "RANGEPICKER",
                    domkey: [
                        "start",
                        "end"
                    ]
                }
            },
            options: [{
                key: "0",
                showname: getLabel(332,"全部"),
                selected: true
            }, {
                key: "1",
                showname: getLabel('505995','今天')
            }, {
                key: "2",
                showname: getLabel('505996','本周')
            }, {
                key: "3",
                showname: getLabel('505997','本月')
            }, {
                key: "5",
                showname: getLabel('506002','本年')
            }, {
                key: "7",
                showname: getLabel('505998','上个月')
            }, {
                key: "8",
                showname: getLabel('505999','上一年')
            }, {
                key: "6",
                showname: getLabel('506000','指定日期范围')
            }
            ],
            domkey: [
                "createDateType",
                "createDate"
            ],
            label: getLabel('505992','到达时间'),
            viewAttr: 3
        }]
    }]
}